package com.sqoq.downloader3.ui

import android.graphics.Color
import androidx.lifecycle.lifecycleScope
import com.sqoq.downloader3.DownloadTool_ddg
import com.sqoq.downloader3.R
import com.sqoq.downloader3.adapter_ddg.DownloadAdapter_ddg
import com.sqoq.downloader3.base_ddg.BaseActivity_ddg
import com.sqoq.downloader3.databinding.ActivityDownloadDdgBinding
import com.sqoq.downloader3.getLanguageString_ddg
import com.sqoq.downloader3.lanuage_ddg.StringId_ddg
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext

class DownloadActivity_ddg : BaseActivity_ddg<ActivityDownloadDdgBinding>() {


    override val layout: Int
        get() = R.layout.activity_download_ddg

    override fun initView() {
        binding.titleDdg.setThemeColor(Color.BLACK)
        binding.titleDdg.setTitleDdg(resources.getLanguageString_ddg(StringId_ddg.Download_ddg))
        var adapter_ddg = DownloadAdapter_ddg(this);
        binding.list.adapter = adapter_ddg
        lifecycleScope.launch(Dispatchers.IO) {
            var data = DownloadTool_ddg.getDownLoadData2()
            withContext(Dispatchers.Main) {
                adapter_ddg.setData(data)
            }
        }

    }
}